package com.example.download.entity;

public class Database {
    private String type;
    private String url;
    private String username;
    private String password;
    private String driverClassName;
    private String tableName;
    private String deriveUrl;
    private String downloadUrl;
    private String saveUrl;
    public Database(TransferDatabase transferDatabase) {
        this.type = transferDatabase.type;
        this.url = "jdbc:mysql://"+transferDatabase.ip+":"+transferDatabase.port+"/"+transferDatabase.databaseName+"?characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useUnicode=true&serverTimezone=Asia/Shanghai";
        this.username = transferDatabase.username;
        this.password = transferDatabase.password;
        this.driverClassName = transferDatabase.driverClassName;
        this.tableName = transferDatabase.tableName;
        this.downloadUrl = "http://"+transferDatabase.ip+":"+transferDatabase.downloadPort+"/"+transferDatabase.downloadLocation+"/";
        this.deriveUrl = transferDatabase.deriveUrl;
        this.saveUrl = transferDatabase.saveUrl;
    }
    public Database() {
    }

    public Database(String type, String url, String username, String password, String driverClassName, String tableName, String deriveUrl, String downloadUrl, String saveUrl) {
        this.type = type;
        this.url = url;
        this.username = username;
        this.password = password;
        this.driverClassName = driverClassName;
        this.tableName = tableName;
        this.deriveUrl = deriveUrl;
        this.downloadUrl = downloadUrl;
        this.saveUrl = saveUrl;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getDriverClassName() {
        return driverClassName;
    }

    public void setDriverClassName(String driverClassName) {
        this.driverClassName = driverClassName;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getDeriveUrl() {
        return deriveUrl;
    }

    public void setDeriveUrl(String deriveUrl) {
        this.deriveUrl = deriveUrl;
    }

    public String getDownloadUrl() {
        return downloadUrl;
    }

    public void setDownloadUrl(String downloadUrl) {
        this.downloadUrl = downloadUrl;
    }

    public String getSaveUrl() {
        return saveUrl;
    }

    public void setSaveUrl(String saveUrl) {
        this.saveUrl = saveUrl;
    }
}
